package com.webage.ejbs;

import java.util.ArrayList;

import javax.ejb.EJB;
import javax.ejb.Stateless;

import nl.saxion.act.dao.ProductDao;
import nl.saxion.act.entity.Product;

@Stateless(name = "ProductBean", mappedName = "ejb/ProductBeanJNDI")
public class ProductBean implements IProductBean {
	private ProductDao productdao /*= new ProductDao()*/;

	@Override
	public double getPrice(int prodnr) {
		// Product product = productdao.getProduct(prodnr);
		// return product.getPrice();
		return 200;
	}

	@Override
	public String getType(int prodnr) {
		// Product product = productdao.getProduct(prodnr);
		// return product.getType();
		return "voertuig";
	}

	@Override
	public ArrayList<Product> getProducts() {
		// return productdao.getProducts();
		ArrayList<Product> productlist = new ArrayList<Product>();
		productlist.add(new Product(100, "auto", "voertuig"));
		productlist.add(new Product(200, "auto", "voertuig"));
		productlist.add(new Product(10, "rozen", "bloemen"));
		productlist.add(new Product(12, "tulpen", "bloemen"));

		return productlist;
	}

	@Override
	public ArrayList<Product> getProductsByType(String type) {
		//return productdao.getProductsByType(type);
		ArrayList<Product> productlist = new ArrayList<Product>();
		productlist.add(new Product(100, "auto", "voertuig"));
		productlist.add(new Product(200, "auto", "voertuig"));
		return productlist;
	}
}
